package thread;

import java.io.IOException;
import java.util.Scanner;

public class ThreadExpandDemo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int  a = 0;

        while (true) {
            try {
                System.out.println("输入一个整数:");
                a = sc.nextInt();
                if(a < 0){
                    continue;
                }
                for (int i = a; i > 0; i--) {
                    System.out.println(i);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
                break;
            } catch (Exception e) {
                System.out.println("输入错误!，请重新输入:");
                sc.nextLine();
            }
        }
        sc.close();

    }
}
